<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
    <title>Main Menu</title>
    <link rel="stylesheet" type="text/css" href="/AplicacionJSF2_2/css/estilos.css"/>	
</head>
<body>
<f:view>
	<h:form>
		<table width="350px;">
			<tr>	
				<td colspan="2" class="celdaTop">
					<h:outputText value="Welcome: "/>
					<c:out value="${sessionScope.username}"/>
				</td>				
			</tr>	
			<tr>
				<td>Usuario</td>
				<td>
					<h:inputText id="user" value="#{userBean.user}" >
						<f:validateLength minimum="5"/>
					</h:inputText>
					<h:message for="userName"/>
				</td>
			</tr>
			<tr>
				<td>Password</td>
				<td>
					<h:inputSecret id="password" value="#{userBean.password}" validator="#{userBean.validaPassword}" />
					<br>
					<h:message for="password"/>
				</td>
			</tr>
			<tr>
				<td>Repeat Password</td>
				<td>
					<h:inputSecret id="password2" value="#{userBean.password2}" validator="#{userBean.validaPassword2}" />					
				</td>
			</tr>
			
			<tr>
				<td>Mail</td>
				<td>
					<h:inputText id="mail"> 
						<f:validator validatorId="emailValidator"/>						
					</h:inputText>
					<br>
					<h:message for="mail"/>
				</td>
			</tr>	
			<tr>
				<td colspan="2">
					<h:commandButton action="#{userBean.guardarUsuario }" value="Save"/>
				</td>
			</tr>
			<tr><td colspan="2" align="right">
					<br>					
						<h:commandLink  value="Volver" action="#{userBean.volver }" immediate="true"/>
			</td></tr>
		</table>
	</h:form>
	
		
</f:view>
</body>
</html>